﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: Propietario			*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESF.General.MVP;
using ESF.SSO.Core.BusinessLogic;
using ESF.General.Entity;

#endregion


namespace ESF.SSO.Presenter.Admin.BasicReference
{
	public class BrowseBasicReferencePresenter : BaseBrowsePagedPresenter<ESF.General.Entity.BasicReference, IBrowseBasicReferenceViewer>
	{
		#region Constructor
		
		public BrowseBasicReferencePresenter (IBrowseBasicReferenceViewer pViewer) : base (pViewer) {}
		
		#endregion
		
		
		#region Funciones

		public override void Load()
		{
			Browse ();
		}
		

		public override void Clear()
		{
			base.Clear ();
			
			_Viewer.Code = string.Empty;
			_Viewer.Name = string.Empty;
		}
		
		
		protected override BrowseResults<ESF.General.Entity.BasicReference>  GetPagedResults(PaggingInfo pPaggingInfo, out ESF.General.Entity.BasicReference pFilter)
		{
			pFilter = new ESF.General.Entity.BasicReference ()
			{
				Code = _Viewer.Code,
				Name = _Viewer.Name,
				BasicReferenceType = new BasicReferenceType ()
				{
					ID = _Viewer.BasicReferenceTypeID
				},
				IsEnabled = null				
			};

 			return CtrlBasicReference.Browse (pFilter, pPaggingInfo);
		}
		
		
		public override void Delete (List<ESF.General.Entity.BasicReference> pItems)
		{
			CtrlBasicReference.Delete (_Viewer.SelectedItems);
		}
		
		#endregion
	}
}
